/*
 * @Author: your name
 * @Date: 2022-01-02 08:55:34
 * @LastEditTime: 2022-01-07 14:33:11
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \my-site\src\api\blog.js
 */
import request from "./request" //axios实例

// 获取所有文章分类
export async function getAllBlogType(){
    return await request.get("/api/blogtype")
}

// 获取分页博客
export async function getPagingBlog(page = 1, limit = 10, categoryId = -1){
    return await request.get("/api/blog", {
        params:{
            page,
            limit,
            categoryId,
        }
    })
}

// 获取单篇博客
export async function getOnlyBlog(id){
    return await request.get(`/api/blog/${id}`)
}

// 提交评论
export async function submitComment(commentInfo){
    return await request.post("/api/comment", commentInfo)
} 

// 分页获取评论
export async function getPagerComment(page = 1, limit = 10, blogId = -1){
    return await request.get("/api/comment", {
        params:{
            page,
            limit,
            blogId,
        }
    })
}